const CDBSave = require('./dbsave');

class User_evaluation_Exp extends CDBSave.CDBSave{
    constructor(){
        super();
    }

    filePath(){
        return 'Express_eva_changda.json'
    }

    load(data){
        if(!data){return;}
        this.notices = data;
    }


    save(){
        return this.notices;
    }

    add_evaluation(User,paoshou,Eval,name){
        var message = new Object();
        message.User = User;
        message.paoshou = paoshou;
        message.Eval = Eval;
        message.name = name;
        let id = this.notices.length + 1;
        message.id = id;
        let add_Eva = new evaluation_Exp_child(message);
        this.notices.push(add_Eva);
    }

    //获取评价信息
    get_Message(){
        return this.notices;
    }
}


class evaluation_Exp_child{
    constructor(message){
        this.load(message);
    }


    load(data){
        this.id = data.id;
        this.User = data.User;
        this.paoshou = data.paoshou;
        this.Eval = data.Eval;
        this.name = data.name;
    }

    save(){
        return{
            id:this.id,
            User:this.User,
            paoshou:this.paoshou,
            Eval:this.Eval,
            name:this.name
        }
    }
}

module.exports = {User_evaluation_Exp,evaluation_Exp_child}